home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / chatr2.zip / IPXLIB.H < prev    next >
C/C++ Source or Header  |  1992-08-31  |  10KB  |  258 lines

  1. /*********************************************************************
  2.  
  3.   IPXLIB.H
  4.  
  5.   Header file for IPXLIB.OBJ, and any applications which call IPXLIB
  6.  
  7. *********************************************************************/
  8.  
  9. /* Beginning of IPXLIB.H */
  10.  
  11.  
  12. #ifndef IPXLIB_H
  13. #define IPXLIB_H
  14.  
  15.  
  16. /**********************************************************************
  17.   IPX_farp
  18.     Defines the standard structure of a far pointer for other IPX
  19.     structures.
  20. **********************************************************************/
  21.  
  22. struct IPX_farp {
  23.     unsigned int offset;  /* offset address of something              */
  24.     unsigned int segment; /* segment (paragraph) address of something */
  25.     };
  26.  
  27.  
  28. /**********************************************************************
  29.   IPX_node
  30.     Defines the standard structure of a local network node address.  
  31.     For Ethernet, this will be the full ethernet address.
  32. **********************************************************************/
  33.  
  34. struct IPX_node {
  35.     unsigned char ch[6];
  36.     };
  37.  
  38.  
  39. /**********************************************************************
  40.   IPX_address
  41.     This structure describes a full address, including network number,
  42.       node address, and socket number.
  43. **********************************************************************/
  44.  
  45. struct IPX_address {
  46.     unsigned long int Network;  /* HI-LO */
  47.     struct IPX_node   Node;     /* HI-LO */
  48.     unsigned int      Socket;   /* HI-LO */
  49.     };
  50.  
  51.  
  52. /**********************************************************************
  53.   IPX_work, IPX_dwork
  54.     Basically, we don't have to do anything with these.  They exist.
  55. **********************************************************************/
  56.  
  57. struct IPX_work {
  58.     unsigned char ch[4];
  59.     };
  60.  
  61. struct IPX_dwork {
  62.     unsigned char ch[12];
  63.     };
  64.  
  65.  
  66. /**********************************************************************
  67.   IPX_frag
  68.     Describes a single fragment of an entire message buffer.
  69. **********************************************************************/
  70.  
  71. struct IPX_frag {
  72.     struct IPX_farp Address;     /* Address of buffer for fragment */
  73.     unsigned int    Size;        /* Length of fragment in bytes    */
  74.     };
  75.  
  76.  
  77. /**********************************************************************
  78.   IPX_ECB
  79.     This is the event control block.  You must fill in some of the
  80.     various fields depending on the particular call you invoke.
  81. **********************************************************************/
  82.  
  83. struct IPX_ECB {
  84.     struct IPX_farp   Link_Address;      /* used by IPX for chaining */
  85.     struct IPX_farp   ESR_Address;       /* address of ESR routine   */
  86.     unsigned char     In_Use;            /* used for polling ECB     */
  87.     unsigned char     Completion_Code;   /* status of ECB request    */
  88.     unsigned int      Socket_Number;     /* HI-LO socket number      */
  89.     struct IPX_work   Workspace;         /* Don't worry about this   */
  90.     struct IPX_dwork  Driver_Workspace;  /* Don't worry about this   */
  91.     struct IPX_node   Immediate_Address; /* Node address send/recv   */
  92.     unsigned int      Fragment_Count;    /* LO-HI # frag descriptors */
  93.     struct IPX_frag   Fragment_Desc[16]; /* up to 16 frag descripts  */
  94.     };
  95.  
  96.  
  97. /***********************************************************************
  98.   IPX_header
  99.     Generally, ECB.Fragment_Desc.Address will point to one of these.
  100.     You must initialize some of the various fields before posting a
  101.     send of listen request.
  102. ***********************************************************************/
  103.  
  104. struct IPX_header {
  105.     unsigned int       Checksum;          /* Not used anymore        */
  106.     unsigned int       Length;            /* Set by IPX              */
  107.     unsigned char      Transport_Control; /* Set by IPX              */
  108.     unsigned char      Packet_Type;       /* 00 for unknown type     */
  109.     struct IPX_address Destination;
  110.     struct IPX_address Source;
  111.     unsigned char      Data[546];         /* Packet data             */
  112.     };
  113.  
  114.  
  115. /***********************************************************************
  116.   IPX_Is_Loaded
  117.     Returns true (0x01) if IPX has been loaded, or false (0x00) if
  118.     it has not been.  ALWAYS call this routine before calling any of
  119.     the others.
  120. ***********************************************************************/
  121.  
  122. unsigned int IPX_Is_Loaded (void);
  123.  
  124.  
  125. /***********************************************************************
  126.   IPX_Open_Socket
  127.     Opens an IPX socket.
  128.     Return values include:
  129.       0x00: Successful
  130.       0xFE: Socket table is full
  131.       0xFF: Socket is already open
  132. ***********************************************************************/
  133.  
  134. unsigned int IPX_Open_Socket (unsigned int Socket_Number);
  135.  
  136.  
  137. /***********************************************************************
  138.   IPX_Close_Socket
  139.     Closes a socket previously opened by IPX_Open_Socket.
  140. ***********************************************************************/
  141.  
  142. void IPX_Close_Socket (unsigned int Socket_Number);
  143.  
  144.  
  145. /***********************************************************************
  146.   IPX_Get_Local_Target
  147.     Returns the six-byte node address of the local target.
  148.     The calling routine supplies a full address (network, node, and
  149.       socket) and the file server returns the address of the closest
  150.       router to Target.  The value in Target should be used as the
  151.       Immediate_Address in a subsequent call to IPX_Send_Packet.
  152.     Destination and Target must be within the same segment.
  153.     Return value is the estimated amount of time to deliver the packet
  154.       to the destination.
  155. ***********************************************************************/
  156.  
  157. unsigned int IPX_Get_Local_Target (struct IPX_address far *Destination,
  158.                                    struct IPX_node    far *Target);
  159.  
  160.  
  161. /***********************************************************************
  162.   IPX_Send_Packet
  163.     Initiates the sending of an IPX packet
  164.     Calling routine must initialize the following fields:
  165.       ECB.ESR_Address         IPX_header.Packet_Type
  166.       ECB.Socket_Number       IPX_header.Destination
  167.       ECB.Immediate_Address
  168.       ECB.Fragment_Count
  169.       ECB.Fragment_Desc
  170.     ECB.ESR_Address should be set to zero.
  171.     After calling this routine, the application should call
  172.       IPX_Relinquish_Control repeatedly until ECB.In_Use == 0.
  173.       At this point, ECB.Completion_Code will be set to:
  174.         0x00: Successful (sent, not necessarily received)
  175.         0xFC: Send request was canceled
  176.         0xFD: The packet was malformed
  177.         0xFE: The packet was undeliverable
  178.         0xFF: IPX was unable to send the packet due to hardware or
  179.                 network failure
  180. ***********************************************************************/
  181.  
  182. void IPX_Send_Packet (struct IPX_ECB far *ECB);
  183.  
  184.  
  185. /***********************************************************************
  186.   IPX_Listen_For_Packet
  187.     Prepares IPX to receive a packet, then returns while IPX attempts
  188.       to listen.
  189.     Calling routine must initialize the following fields:
  190.       ECB.ESR_Address
  191.       ECB.Socket_Number
  192.       ECB.Fragment_Count
  193.       ECB.Fragment_Desc
  194.     ECB.ESR_Address points to the address of a routine which is
  195.       called by IPX when a packet is received.  This routine is
  196.       treated as an interrupt service routine, and must be terminated
  197.       with an IRET instruction.  On entrance to the ESR, ES:SI -> the
  198.       associated ECB.  Since the C language is not well suited for
  199.       this type of processing, ECB.ESR_Address should be set to zero,
  200.       which will disable ESR processing.
  201.     After calling this routine, the application should occasionally
  202.       call IPX_Relinquish_Control to ensure that the IPX driver gets
  203.       enough execution time to actually listen for a packet.
  204.     After calling this routine, the application should monitor
  205.       ECB.In_Use.  This field is immediately set to FEh, and remains
  206.       at that value until a packet is received, an error occurs, or
  207.       IPX_Cancel_Event is invoked against the ECB.
  208. ***********************************************************************/
  209.  
  210. void IPX_Listen_For_Packet (struct IPX_ECB far *ECB);
  211.  
  212.  
  213. /***********************************************************************
  214.   IPX_Cancel_Event
  215.     Cancel an ECB that is currently In_Use.
  216. ***********************************************************************/
  217.  
  218. void IPX_Cancel_Event (struct IPX_ECB far *ECB);
  219.  
  220.  
  221. /***********************************************************************
  222.   IPX_Get_Internetwork_Address
  223.     Returns the network and node address of the workstation.
  224. ***********************************************************************/
  225.  
  226. void IPX_Get_Internetwork_Address (struct IPX_address far *Address);
  227.  
  228.  
  229. /***********************************************************************
  230.   IPX_Relinquish_Control
  231.     Gives the IPX driver some CPU time to accomplish what it needs to
  232.     do.
  233. ***********************************************************************/
  234.  
  235. void IPX_Relinquish_Control (void);
  236.  
  237.  
  238. /***********************************************************************
  239.   IPX_Flipword
  240.     Reverses the order of bytes within a two-byte unsigned int.
  241. ***********************************************************************/
  242.  
  243. unsigned int IPX_Flipword (unsigned int Inword);
  244.  
  245.  
  246. /***********************************************************************
  247.   IPX_Fliplong
  248.     Reverses the order of the bytes within a 4-byte sequence of type
  249.     unsigned long.
  250. ***********************************************************************/
  251.  
  252. void IPX_Fliplong (unsigned long *Inlong);
  253.  
  254. #endif
  255.  
  256. /* End of IPXLIB.H */
  257.  
  258.